package com.tj.collection.enums;

/**
 * Author: Karl
 * Date: 2020/12/28 4:04 下午
 */
public enum UserLanguageEnum {
    HINDI(0, "Hindi"),
    TELUGU(1, "Telugu"),
    KANNADA(2, "Kannada"),
    TAMIL(3, "Tamil"),
    MALAYALAM(4, "Malayalam");

    private Integer type;
    private String desc;

    UserLanguageEnum(Integer type, String desc) {
        this.type = type;
        this.desc = desc;
    }

    public Integer getType() {
        return type;
    }

    public UserLanguageEnum setType(Integer type) {
        this.type = type;
        return this;
    }

    public String getDesc() {
        return desc;
    }

    public UserLanguageEnum setDesc(String desc) {
        this.desc = desc;
        return this;
    }

    public static UserLanguageEnum getEnumByType(Integer type) {
        UserLanguageEnum userLanguageEnum = null;
        for (UserLanguageEnum enumObj : UserLanguageEnum.values()) {
            if (enumObj.getType().equals(type)) {
                userLanguageEnum = enumObj;
                break;
            }
        }
        return userLanguageEnum;
    }

    public static UserLanguageEnum getEnumByDesc(String desc) {
        UserLanguageEnum userLanguageEnum = null;
        for (UserLanguageEnum enumObj : UserLanguageEnum.values()) {
            if (enumObj.getDesc().equals(desc)) {
                userLanguageEnum = enumObj;
                break;
            }
        }
        return userLanguageEnum;
    }
}